package com.yunjing.elasticjob.quartz;

import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.stereotype.Component;

/**
 * @author zhiqi.shao
 * @Date 2018/6/14 11:53
 */
@Slf4j
@Component
public class RemindJob implements Job {

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        before();
        /**todo 需要根据job的type 一次性任务直接标记过期，以后重启服务不会再去加载
         * 对与多久一次的任务，重启时需要服务重新加载，或者服务缩减，应该将任务推送到其他服务上去。
         */
        log.info("JobDetail name:{}",context.getJobDetail().getKey().getName());
        after();
    }

    private void before(){
        log.info(" is before");
    }

    private void after(){
        log.info(" is after");
    }
}
